package ltd.dujiabao.performance.monitor.pm.domain;

import java.util.ArrayList;
import java.util.List;

import ltd.dujiabao.performance.monitor.pm.event.CollectEvent;

/**
 * @author : DuJiabao
 * @Project : performance_monitor
 * @Time : 2022/2/27 21:26
 * @Desc :
 */
public class PerformanceAdapter {
    public static List<Performance> toPerformances(CollectEvent collectEvent) {
        String[] urls = collectEvent.getUrls();
        Long timeConsuming = collectEvent.getTimeConsuming();
        ArrayList<Performance> result = new ArrayList<>(urls.length);
        for (String url : urls) {
            Performance performance = new Performance();
            performance.setRequestUrl(url);
            performance.setTimeConsuming(timeConsuming);
            result.add(performance);
        }
        return result;
    }
}
